home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / WorldScript.a < prev   
Encoding:
Text File  |  1996-01-24  |  11.8 KB  |  392 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        WorldScript.a
  3. ;
  4. ;    Contains:    WorldScript I Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__WORLDSCRIPT__') = 'UNDEFINED' THEN
  21. __WORLDSCRIPT__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__TRAPS__') = 'UNDEFINED' THEN
  30.     include 'Traps.a'
  31.     ENDIF
  32.  
  33.     IF &TYPE('__QUICKDRAWTEXT__') = 'UNDEFINED' THEN
  34.     include 'QuickdrawText.a'
  35.     ENDIF
  36. ;        include 'MixedMode.a'                                        ;
  37. ; typedef UInt16             WSIOffset
  38. ; typedef UInt8             WSIByteCount
  39. ; typedef UInt8             WSIByteIndex
  40. ; offset from start of sub-table to row in state table 
  41. ; typedef UInt16             WSIStateOffset
  42. ; typedef UInt32             WSITableOffset
  43. ; typedef UInt16             WSISubtableOffset
  44. ; typedef UInt16             WSIGlyphcode
  45. ; typedef UInt32             WSITableIdentifiers
  46.  
  47. kScriptSettingsTag                EQU        'info'
  48. kMetamorphosisTag                EQU        'mort'
  49. kGlyphExpansionTag                EQU        'g2g#'
  50. kPropertiesTag                    EQU        'prop'
  51. kJustificationTag                EQU        'kash'
  52. kCharToGlyphTag                    EQU        'cmap'
  53. kGlyphToCharTag                    EQU        'pamc'
  54. kFindScriptRunTag                EQU        'fstb'
  55.  
  56. ;***             L O O K U P    T A B L E    T Y P E S        ***
  57. WSILookupSimpleArray            EQU        0                    ; a simple array indexed by glyph code 
  58. WSILookupSegmentSingle            EQU        2                    ; segment mapping to single value 
  59. WSILookupSegmentArray            EQU        4                    ; segment mapping to lookup array 
  60. WSILookupSingleTable            EQU        6                    ; sorted list of glyph, value pairs 
  61. WSILookupTrimmedArray            EQU        8                    ; a simple trimmed array indexed by glyph code 
  62.  
  63. ; typedef unsigned short     WSILookupTableFormat
  64. ; typedef unsigned short     WSILookupValue
  65. ; An offset from the beginning of the lookup table 
  66. ; typedef unsigned short     WSILookupOffset
  67. ;    FORMAT SPECIFIC DEFINITIONS 
  68. ;
  69. ;        lookupSimpleArray:
  70. ;        
  71. ;        This is a simple array which maps all glyphs in the font
  72. ;        to lookup values.
  73. ;    
  74. WSILookupArrayHeader     RECORD    0
  75. lookupValues             ds.w   1        ; offset: $0 (0)        ; The array of values indexed by glyph code 
  76. sizeof                     EQU *            ; size:   $2 (2)
  77.                         ENDR
  78.  
  79. ; typedef struct WSILookupArrayHeader  WSILookupArrayHeader
  80. ;
  81. ;        lookupTrimmedArray:
  82. ;        
  83. ;        This is a single trimmed array which maps a single range
  84. ;        of glyhs in the font to lookup values.
  85. ;    
  86. WSILookupTrimmedArrayHeader RECORD    0
  87. firstGlyph                 ds.w   1        ; offset: $0 (0)
  88. limitGlyph                 ds.w   1        ; offset: $2 (2)
  89. valueArray                 ds.w   1        ; offset: $4 (4)
  90. sizeof                     EQU *            ; size:   $6 (6)
  91.                         ENDR
  92.  
  93. ; typedef struct WSILookupTrimmedArrayHeader  WSILookupTrimmedArrayHeader
  94. ; The format specific part of the subtable header 
  95. WSILookupFormatSpecificHeader RECORD    0
  96. lookupArray                 ds     WSILookupArrayHeader ; offset: $0 (0)
  97.                          ORG 0
  98. trimmedArray             ds     WSILookupTrimmedArrayHeader ; offset: $0 (0)
  99.                          ORG 6
  100. sizeof                     EQU *            ; size:   $6 (6)
  101.                         ENDR
  102.  
  103. ; typedef union WSILookupFormatSpecificHeader  WSILookupFormatSpecificHeader
  104. ; The overall subtable header 
  105. WSILookupTableHeader     RECORD    0
  106. format                     ds.w   1        ; offset: $0 (0)        ; table format 
  107. fsHeader                 ds.w   3        ; offset: $2 (2)        ; format specific header 
  108. sizeof                     EQU *            ; size:   $8 (8)
  109.                         ENDR
  110.  
  111. ; typedef struct WSILookupTableHeader  WSILookupTableHeader
  112. ;***        G L Y P H    E X P A N S I O N    ***
  113.  
  114. ; fixed 1.0 
  115. kCurrentGlyphExpansionVersion    EQU        $00010000
  116.  
  117. ; typedef unsigned short     GlyphExpansionFormats
  118.  
  119. GlyphExpansionLookupFormat        EQU        1
  120. GlyphExpansionContextualFormat    EQU        2
  121.  
  122. ExpandedGlyphCluster     RECORD    0
  123. numGlyphs                 ds.b   1        ; offset: $0 (0)
  124. bestGlyph                 ds.b   1        ; offset: $1 (1)
  125. glyphs                     ds.w   1        ; offset: $2 (2)
  126. sizeof                     EQU *            ; size:   $4 (4)
  127.                         ENDR
  128.  
  129. ; typedef struct ExpandedGlyphCluster  ExpandedGlyphCluster
  130. ExpandedGlyphOffset     RECORD    0
  131. glyph                     ds.w   1        ; offset: $0 (0)
  132. offset                     ds.w   1        ; offset: $2 (2)        ; offset to ExpandedGlyphCluster 
  133. sizeof                     EQU *            ; size:   $4 (4)
  134.                         ENDR
  135.  
  136. ; typedef struct ExpandedGlyphOffset  ExpandedGlyphOffset
  137. GlyphExpansionStateTable RECORD    0
  138. stateTableOffset         ds.w   1        ; offset: $0 (0)
  139. classTableOffset         ds.w   1        ; offset: $2 (2)
  140. actionTableOffset         ds.w   1        ; offset: $4 (4)        ; state, class and actions tables follow here... 
  141. sizeof                     EQU *            ; size:   $6 (6)
  142.                         ENDR
  143.  
  144. ; typedef GlyphExpansionStateTable  GlyphExpansionStateTable
  145. GlyphExpansionTable     RECORD    0
  146. version                     ds.l   1        ; offset: $0 (0)
  147. format                     ds.w   1        ; offset: $4 (4)
  148. expansionNumer             ds.w   1        ; offset: $6 (6)
  149. expansionDenom             ds.w   1        ; offset: $8 (8)        ; num/denom ratio for expansion <2> 
  150. stateTable                 ds     GlyphExpansionStateTable ; offset: $A (10)
  151.                          ORG 10
  152. lookup                     ds     WSILookupTableHeader ; offset: $A (10) ; expanded glyph clusters follow here... 
  153.                          ORG 18
  154. sizeof                     EQU *            ; size:   $12 (18)
  155.                         ENDR
  156.  
  157. ; typedef struct GlyphExpansionTable  GlyphExpansionTable
  158. ; Glyph-to-Character constants and types  
  159.  
  160. kCurrentGlyphToCharVersion        EQU        $00010100
  161.  
  162. ; typedef unsigned short     GlyphToCharLookupFormats
  163.  
  164. kGlyphToCharLookup8Format        EQU        1
  165. kGlyphToCharLookup16Format        EQU        2
  166. kGlyphToCharLookup32Format        EQU        3
  167.  
  168. ; typedef UInt8             GlyphToCharFontIndex
  169. ; typedef UInt8             QDGlyphcode
  170. GlyphToCharActionTable     RECORD    0
  171. fontNameOffset             ds.w   1        ; offset: $0 (0)        ; offset relative to this table 
  172. actions                     ds     WSILookupTableHeader ; offset: $2 (2) ; only support lookupSimpleArray format for now 
  173. sizeof                     EQU *            ; size:   $A (10)
  174.                         ENDR
  175.  
  176. ; typedef struct GlyphToCharActionTable  GlyphToCharActionTable
  177. GlyphToCharActionHeader RECORD    0
  178. numTables                 ds.w   1        ; offset: $0 (0)        ; 0..n 
  179. offsets                     ds.w   1        ; offset: $2 (2)        ; offsets from start of action table header 
  180. sizeof                     EQU *            ; size:   $4 (4)
  181.                         ENDR
  182.  
  183. ; typedef struct GlyphToCharActionHeader  GlyphToCharActionHeader
  184. GlyphToCharHeader         RECORD    0
  185. version                     ds.l   1        ; offset: $0 (0)
  186. actionOffset             ds.w   1        ; offset: $4 (4)        ; offset to GlyphToCharActionHeader 
  187. format                     ds.w   1        ; offset: $6 (6)        ; size of font mask 
  188. mappingTable             ds     WSILookupTableHeader ; offset: $8 (8)
  189. sizeof                     EQU *            ; size:   $10 (16)
  190.                         ENDR
  191.  
  192. ; typedef struct GlyphToCharHeader  GlyphToCharHeader
  193. ; JUSTIFICATION TYPES
  194. ;    WorldScript supports justification of text using insertion. The justification
  195. ;    table specifies a insertion string to insert between 2 specified glyphs.
  196. ;    Each combination of inter-glyph boundary can be assigned a justification priority,
  197. ;    the higher the priority the more justification strings inserted at that position.
  198. ;    
  199. ;    The priorities for each inter-glyph boundary are specified by the justification table's
  200. ;    state table.
  201. ;    
  202. ;    Special handling is done for scripts which use spaces to justify, because the width of 
  203. ;    a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  204. ;    per inserting string is specified in the justification table.
  205. ;
  206. ;
  207.  
  208. ; 1.0 not supported 
  209. kCurrentJustificationVersion    EQU        $0200
  210.  
  211. kJustificationStateTableFormat    EQU        1
  212.  
  213. ; WSI's internal limitation <12> 
  214. kMaxJustificationStringLength    EQU        13
  215.  
  216. ; typedef UInt8             WSIJustificationPriority
  217.  
  218. WSIJustificationSetMarkMask        EQU        $80
  219.  
  220. WSIJustificationStateEntry RECORD    0
  221. markPriority             ds.b   1        ; offset: $0 (0)        ; non-zero priorities means insertion 
  222. priority                 ds.b   1        ; offset: $1 (1)
  223. newState                 ds.w   1        ; offset: $2 (2)
  224. sizeof                     EQU *            ; size:   $4 (4)
  225.                         ENDR
  226.  
  227. ; typedef struct WSIJustificationStateEntry  WSIJustificationStateEntry
  228. ; typedef unsigned short     WSIJustificationClasses
  229.  
  230. wsiJustEndOfLineClass            EQU        0
  231. wsiJustEndOfRunClass            EQU        1
  232. wsiJustDeletedGlyphClass        EQU        2
  233. wsiJustUserDefinedClass            EQU        3
  234.  
  235. ; typedef unsigned short     WSIJustificationStates
  236.  
  237. wsiStartOfLineState                EQU        0                    ; pre-defined states 
  238. wsiStartOfRunState                EQU        1
  239. wsiUserDefinedState                EQU        2
  240.  
  241. ; pre-multiplied: class# * sizeof(WSIJustificationStateEntry) 
  242. ; typedef UInt8             WSIJustificationClassOffset
  243. WSIJustificationStateTable RECORD    0
  244. maxPriorities             ds.w   1        ; offset: $0 (0)
  245. rowWidth                 ds.w   1        ; offset: $2 (2)        ; width of a state table row in bytes 
  246. classTableOffset         ds.w   1        ; offset: $4 (4)
  247. stateTableOffset         ds.w   1        ; offset: $6 (6)
  248. sizeof                     EQU *            ; size:   $8 (8)
  249.                         ENDR
  250.  
  251. ; typedef struct WSIJustificationStateTable  WSIJustificationStateTable
  252. WSIJustificationHeader     RECORD    0
  253. version                     ds.w   1        ; offset: $0 (0)
  254. format                     ds.w   1        ; offset: $2 (2)
  255. scaling                     ds     Point    ; offset: $4 (4)        ; numer/denom scaling of priority weights <7> 
  256. spacesPerInsertion         ds.w   1        ; offset: $8 (8)        ; # of $20 chars in justification insertion string <12> 
  257. justStringOffset         ds.w   1        ; offset: $A (10)        ; offset to justification string 
  258. stateTable                 ds     WSIJustificationStateTable ; offset: $C (12) ; long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows 
  259. sizeof                     EQU *            ; size:   $14 (20)
  260.                         ENDR
  261.  
  262. ; typedef struct WSIJustificationHeader  WSIJustificationHeader
  263. ; Line Layout's Property table version <11> 
  264.  
  265. ; v1.0 
  266. currentPropsTableVersion        EQU        $00010000
  267.  
  268. ; ??? is this right 
  269. kCharToGlyphCurrentVersion        EQU        0100
  270.  
  271. ; pass as priorityWeight to JustifyWSILayout to use script's current just setting 
  272. kScriptsDefaultJustWeight        EQU        -1
  273.  
  274. WSIGlyphInfoRec         RECORD    0
  275. qdChar                     ds.b   1        ; offset: $0 (0)
  276. rightToLeft                 ds.b   1        ; offset: $1 (1)        ; !0 means rightToLeft, 0 means leftToRight 
  277. fontID                     ds.w   1        ; offset: $2 (2)
  278. originalOffset             ds.w   1        ; offset: $4 (4)        ; or negative original offset if not in original text input 
  279. unused                     ds.w   1        ; offset: $6 (6)        ; long-align 
  280. sizeof                     EQU *            ; size:   $8 (8)
  281.                         ENDR
  282.  
  283. ; typedef struct WSIGlyphInfoRec  WSIGlyphInfoRec, **WSIGlyphInfoHandle
  284. ; typedef Handle             WSILayoutHandle
  285. ;
  286. ; pascal WSILayoutHandle NewWSILayout(WSILayoutHandle layoutH, Ptr text, short txLength, short lineDirection, unsigned long flags, OSErr *err)
  287. ;
  288.     IF ¬ GENERATINGCFM THEN
  289.         Macro
  290.         _NewWSILayout
  291.             dc.w     $2F3C
  292.             dc.w     $8414
  293.             dc.w     $0040
  294.             dc.w     $A8B5
  295.         EndM
  296.     ELSE
  297.         IMPORT_CFM_FUNCTION    NewWSILayout
  298.     ENDIF
  299.  
  300. ;
  301. ; pascal WSILayoutHandle JustifyWSILayout(WSILayoutHandle layoutH, Fixed slop, short priorityWeight, JustStyleCode styleRunPosition, Point numer, Point denom, OSErr *err)
  302. ;
  303.     IF ¬ GENERATINGCFM THEN
  304.         Macro
  305.         _JustifyWSILayout
  306.             dc.w     $2F3C
  307.             dc.w     $8418
  308.             dc.w     $0042
  309.             dc.w     $A8B5
  310.         EndM
  311.     ELSE
  312.         IMPORT_CFM_FUNCTION    JustifyWSILayout
  313.     ENDIF
  314.  
  315. ;
  316. ; pascal Fixed MeasureWSILayout(WSILayoutHandle layoutH, Point numer, Point denom)
  317. ;
  318.     IF ¬ GENERATINGCFM THEN
  319.         Macro
  320.         _MeasureWSILayout
  321.             dc.w     $2F3C
  322.             dc.w     $840C
  323.             dc.w     $0044
  324.             dc.w     $A8B5
  325.         EndM
  326.     ELSE
  327.         IMPORT_CFM_FUNCTION    MeasureWSILayout
  328.     ENDIF
  329.  
  330. ;
  331. ; pascal void DrawWSILayout(WSILayoutHandle layoutH, Point numer, Point denom)
  332. ;
  333.     IF ¬ GENERATINGCFM THEN
  334.         Macro
  335.         _DrawWSILayout
  336.             dc.w     $2F3C
  337.             dc.w     $800C
  338.             dc.w     $0046
  339.             dc.w     $A8B5
  340.         EndM
  341.     ELSE
  342.         IMPORT_CFM_FUNCTION    DrawWSILayout
  343.     ENDIF
  344.  
  345. ; "low-level" routines 
  346. ;
  347. ; pascal WSIGlyphInfoHandle GetWSILayoutParts(WSILayoutHandle layoutH, WSIGlyphInfoHandle destH, short *numGlyphs, OSErr *err)
  348. ;
  349.     IF ¬ GENERATINGCFM THEN
  350.         Macro
  351.         _GetWSILayoutParts
  352.             dc.w     $2F3C
  353.             dc.w     $8410
  354.             dc.w     $0048
  355.             dc.w     $A8B5
  356.         EndM
  357.     ELSE
  358.         IMPORT_CFM_FUNCTION    GetWSILayoutParts
  359.     ENDIF
  360.  
  361. ;
  362. ; pascal void DrawWSIGlyphs(short length, Ptr qdCodes, Point numer, Point denom)
  363. ;
  364.     IF ¬ GENERATINGCFM THEN
  365.         Macro
  366.         _DrawWSIGlyphs
  367.             dc.w     $2F3C
  368.             dc.w     $800E
  369.             dc.w     $004A
  370.             dc.w     $A8B5
  371.         EndM
  372.     ELSE
  373.         IMPORT_CFM_FUNCTION    DrawWSIGlyphs
  374.     ENDIF
  375.  
  376. ;
  377. ; pascal Fixed xMeasureWSIGlyphs(Ptr *qdCodes, short length, Point numer, Point denom)
  378. ;
  379.     IF ¬ GENERATINGCFM THEN
  380.         Macro
  381.         _xMeasureWSIGlyphs
  382.             dc.w     $2F3C
  383.             dc.w     $840E
  384.             dc.w     $004C
  385.             dc.w     $A8B5
  386.         EndM
  387.     ELSE
  388.         IMPORT_CFM_FUNCTION    xMeasureWSIGlyphs
  389.     ENDIF
  390.  
  391.     ENDIF ; __WORLDSCRIPT__
  392.